{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "93446165",
   "metadata": {},
   "source": [
    "----\n",
    "* 阶段: week10\n",
    "* 目标: 实现web应用\n",
    "* 时间：2023-11-08"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "73043617",
   "metadata": {},
   "source": [
    "# 本周内容：Web应用"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c8a89002",
   "metadata": {},
   "source": [
    "##  使用Flask 搭建web最小应用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "dd188b5a",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (892436775.py, line 10)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Input \u001b[1;32mIn [16]\u001b[1;36m\u001b[0m\n\u001b[1;33m    if_name_ == '_main_':\u001b[0m\n\u001b[1;37m                         ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "from flask import Flask\n",
    "from flask import render_template\n",
    "\n",
    "app = Flask(_name_)\n",
    "\n",
    "@app.route('/')\n",
    "def hello_world():\n",
    "    return render_template('index.html')\n",
    "\n",
    "if_name_ == '_main_':\n",
    "    app.run()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "46dde3a2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: requests_html in c:\\users\\dell\\anaconda3\\lib\\site-packages (0.10.0)\n",
      "Requirement already satisfied: parse in c:\\users\\dell\\anaconda3\\lib\\site-packages (from requests_html) (1.19.1)\n",
      "Requirement already satisfied: w3lib in c:\\users\\dell\\anaconda3\\lib\\site-packages (from requests_html) (1.21.0)\n",
      "Requirement already satisfied: pyppeteer>=0.0.14 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from requests_html) (1.0.2)\n",
      "Requirement already satisfied: fake-useragent in c:\\users\\dell\\anaconda3\\lib\\site-packages (from requests_html) (1.2.1)\n",
      "Requirement already satisfied: pyquery in c:\\users\\dell\\anaconda3\\lib\\site-packages (from requests_html) (2.0.0)\n",
      "Requirement already satisfied: requests in c:\\users\\dell\\anaconda3\\lib\\site-packages (from requests_html) (2.27.1)\n",
      "Requirement already satisfied: bs4 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from requests_html) (0.0.1)\n",
      "Requirement already satisfied: websockets<11.0,>=10.0 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from pyppeteer>=0.0.14->requests_html) (10.4)\n",
      "Requirement already satisfied: tqdm<5.0.0,>=4.42.1 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from pyppeteer>=0.0.14->requests_html) (4.64.0)\n",
      "Requirement already satisfied: pyee<9.0.0,>=8.1.0 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from pyppeteer>=0.0.14->requests_html) (8.2.2)\n",
      "Requirement already satisfied: appdirs<2.0.0,>=1.4.3 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from pyppeteer>=0.0.14->requests_html) (1.4.4)\n",
      "Requirement already satisfied: urllib3<2.0.0,>=1.25.8 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from pyppeteer>=0.0.14->requests_html) (1.26.9)\n",
      "Requirement already satisfied: certifi>=2021 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from pyppeteer>=0.0.14->requests_html) (2021.10.8)\n",
      "Requirement already satisfied: importlib-metadata>=1.4 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from pyppeteer>=0.0.14->requests_html) (4.11.3)\n",
      "Requirement already satisfied: zipp>=0.5 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from importlib-metadata>=1.4->pyppeteer>=0.0.14->requests_html) (3.7.0)\n",
      "Requirement already satisfied: colorama in c:\\users\\dell\\anaconda3\\lib\\site-packages (from tqdm<5.0.0,>=4.42.1->pyppeteer>=0.0.14->requests_html) (0.4.4)\n",
      "Requirement already satisfied: beautifulsoup4 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from bs4->requests_html) (4.11.1)\n",
      "Requirement already satisfied: soupsieve>1.2 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from beautifulsoup4->bs4->requests_html) (2.3.1)\n",
      "Requirement already satisfied: importlib-resources>=5.0 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from fake-useragent->requests_html) (6.0.1)\n",
      "Requirement already satisfied: lxml>=2.1 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from pyquery->requests_html) (4.8.0)\n",
      "Requirement already satisfied: cssselect>=1.2.0 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from pyquery->requests_html) (1.2.0)\n",
      "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from requests->requests_html) (3.3)\n",
      "Requirement already satisfied: charset-normalizer~=2.0.0 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from requests->requests_html) (2.0.4)\n",
      "Requirement already satisfied: six>=1.4.1 in c:\\users\\dell\\anaconda3\\lib\\site-packages (from w3lib->requests_html) (1.16.0)\n"
     ]
    }
   ],
   "source": [
    "!pip install requests_html"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f64363c8",
   "metadata": {},
   "source": [
    "## 提交表单的内容在python中接收"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "9e782116",
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'crawl_liepin'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Input \u001b[1;32mIn [4]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mcrawl_liepin\u001b[39;00m\n\u001b[0;32m      3\u001b[0m crawl_liepin\u001b[38;5;241m.\u001b[39mcrawl(城市\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m深圳\u001b[39m\u001b[38;5;124m\"\u001b[39m,关键词\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m产品经理\u001b[39m\u001b[38;5;124m\"\u001b[39m,工作经验\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m应届生\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
      "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'crawl_liepin'"
     ]
    }
   ],
   "source": [
    "import crawl_liepin\n",
    "\n",
    "crawl_liepin.crawl(城市=\"深圳\",关键词=\"产品经理\",工作经验='应届生')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "dbaf0e48",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'inited_user=daf7251f92024e8969feb28b0e9ad34c; XSRF-TOKEN=SIVa3Y_gRaqR7k-mI1I6kQ; __gc_id=d474cd1529ae40a29b8f9c81b7e60de7; _ga=GA1.1.1301373590.1698838360; __uuid=1698838362686.73; __tlog=1698838362732.34%7C00000000%7C00000000%7C00000000%7C00000000; acw_tc=276077be16988383924452585e8d8e297846bb9fcc8c8f34695b420d154b08; Hm_lvt_a2647413544f5a04f00da7eee0d5e200=1698838365; UniqueKey=95507c72a8d5ae141a667e00ad0d9493; liepin_login_valid=0; lt_auth=u%2B5bbHQGxlzxtXfR3zQN4vociI39UWvIpX8EhE0Ahoe%2BCqG04PngSwOGq7EExAMhlkh1ccULN7n2Pev2zXtP4kcTwGqnl4CyvOW92GECTeNcN8W2vezHl8zRQpQcl0AC8nFbtkIL%2BQ%3D%3D; access_system=C; user_roles=0; user_photo=5f8fa3a679c7cc70efbf444e08u.png; user_name=%E8%AE%B8%E6%99%BA%E8%B6%85; need_bind_tel=false; new_user=false; c_flag=fa43f4d55f3df63a96a7b4f194e214d4; inited_user=daf7251f92024e8969feb28b0e9ad34c; Hm_lpvt_a2647413544f5a04f00da7eee0d5e200=1698838461; imId=c5f9b89f8466dffe6882ca1e5431db9c; imId_0=c5f9b89f8466dffe6882ca1e5431db9c; imClientId=c5f9b89f8466dffeb1921abcfab3aed0; imClientId_0=c5f9b89f8466dffeb1921abcfab3aed0; imApp_0=1; __session_seq=7; __uv_seq=7; fe_im_socketSequence_new_0=1_1_1; __tlg_event_seq=116; fe_im_opened_pages=; fe_im_connectJson_0=%7B%220_95507c72a8d5ae141a667e00ad0d9493%22%3A%7B%22socketConnect%22%3A%222%22%2C%22connectDomain%22%3A%22liepin.com%22%7D%7D; _ga_54YTJKWN86=GS1.1.1698838360.1.1.1698838528.0.0.0'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 建立登陆cookie\n",
    "cookie = \"inited_user=daf7251f92024e8969feb28b0e9ad34c; XSRF-TOKEN=SIVa3Y_gRaqR7k-mI1I6kQ; __gc_id=d474cd1529ae40a29b8f9c81b7e60de7; _ga=GA1.1.1301373590.1698838360; __uuid=1698838362686.73; __tlog=1698838362732.34%7C00000000%7C00000000%7C00000000%7C00000000; acw_tc=276077be16988383924452585e8d8e297846bb9fcc8c8f34695b420d154b08; Hm_lvt_a2647413544f5a04f00da7eee0d5e200=1698838365; UniqueKey=95507c72a8d5ae141a667e00ad0d9493; liepin_login_valid=0; lt_auth=u%2B5bbHQGxlzxtXfR3zQN4vociI39UWvIpX8EhE0Ahoe%2BCqG04PngSwOGq7EExAMhlkh1ccULN7n2Pev2zXtP4kcTwGqnl4CyvOW92GECTeNcN8W2vezHl8zRQpQcl0AC8nFbtkIL%2BQ%3D%3D; access_system=C; user_roles=0; user_photo=5f8fa3a679c7cc70efbf444e08u.png; user_name=%E8%AE%B8%E6%99%BA%E8%B6%85; need_bind_tel=false; new_user=false; c_flag=fa43f4d55f3df63a96a7b4f194e214d4; inited_user=daf7251f92024e8969feb28b0e9ad34c; Hm_lpvt_a2647413544f5a04f00da7eee0d5e200=1698838461; imId=c5f9b89f8466dffe6882ca1e5431db9c; imId_0=c5f9b89f8466dffe6882ca1e5431db9c; imClientId=c5f9b89f8466dffeb1921abcfab3aed0; imClientId_0=c5f9b89f8466dffeb1921abcfab3aed0; imApp_0=1; __session_seq=7; __uv_seq=7; fe_im_socketSequence_new_0=1_1_1; __tlg_event_seq=116; fe_im_opened_pages=; fe_im_connectJson_0=%7B%220_95507c72a8d5ae141a667e00ad0d9493%22%3A%7B%22socketConnect%22%3A%222%22%2C%22connectDomain%22%3A%22liepin.com%22%7D%7D; _ga_54YTJKWN86=GS1.1.1698838360.1.1.1698838528.0.0.0\"\n",
    "cookie"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "667b609f",
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'crawl_liepin'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Input \u001b[1;32mIn [6]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mcrawl_liepin\u001b[39;00m\n\u001b[0;32m      3\u001b[0m 产品经理_深圳_results \u001b[38;5;241m=\u001b[39m crawl_liepin\u001b[38;5;241m.\u001b[39mcrawl(城市\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m深圳\u001b[39m\u001b[38;5;124m\"\u001b[39m,关键词\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m产品经理\u001b[39m\u001b[38;5;124m\"\u001b[39m,工作经验\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m'\u001b[39m,登录cookie\u001b[38;5;241m=\u001b[39mcookie)\n",
      "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'crawl_liepin'"
     ]
    }
   ],
   "source": [
    "import crawl_liepin\n",
    "\n",
    "产品经理_深圳_results = crawl_liepin.crawl(城市=\"深圳\",关键词=\"产品经理\",工作经验='',登录cookie=cookie)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "921f609a",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name '产品经理_深圳_results' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [7]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43m产品经理_深圳_results\u001b[49m\n",
      "\u001b[1;31mNameError\u001b[0m: name '产品经理_深圳_results' is not defined"
     ]
    }
   ],
   "source": [
    "产品经理_深圳_results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "377ac2eb",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name '产品经理_深圳_results' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [8]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43m产品经理_深圳_results\u001b[49m\u001b[38;5;241m.\u001b[39mcolumns\n",
      "\u001b[1;31mNameError\u001b[0m: name '产品经理_深圳_results' is not defined"
     ]
    }
   ],
   "source": [
    "产品经理_深圳_results.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "cbfa4005",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name '产品经理_深圳_results' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [9]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m series_dq \u001b[38;5;241m=\u001b[39m \u001b[43m产品经理_深圳_results\u001b[49m[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mjob.dq\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39mvalue_counts()\n\u001b[0;32m      2\u001b[0m series_dq\n",
      "\u001b[1;31mNameError\u001b[0m: name '产品经理_深圳_results' is not defined"
     ]
    }
   ],
   "source": [
    "series_dq = 产品经理_深圳_results['job.dq'].value_counts()\n",
    "series_dq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "f62e1023",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'series_dq' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [10]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m dq_name\u001b[38;5;241m=\u001b[39m [i \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[43mseries_dq\u001b[49m\u001b[38;5;241m.\u001b[39mindex \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m-\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m i]\n\u001b[0;32m      2\u001b[0m dq_name\n",
      "\u001b[1;31mNameError\u001b[0m: name 'series_dq' is not defined"
     ]
    }
   ],
   "source": [
    "dq_name= [i for i in series_dq.index if '-' in i]\n",
    "dq_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "a1f1ccf8",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'series_dq' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [11]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mseries_dq\u001b[49m[dq_name]\u001b[38;5;241m.\u001b[39mvalues\n",
      "\u001b[1;31mNameError\u001b[0m: name 'series_dq' is not defined"
     ]
    }
   ],
   "source": [
    "series_dq[dq_name].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "be7fe0c7",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Map\n",
    "from pyecharts.faker import Faker"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "2cca977c",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'dq_name' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [13]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m [i\u001b[38;5;241m.\u001b[39msplit(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m-\u001b[39m\u001b[38;5;124m'\u001b[39m)[\u001b[38;5;241m1\u001b[39m] \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[43mdq_name\u001b[49m]\n",
      "\u001b[1;31mNameError\u001b[0m: name 'dq_name' is not defined"
     ]
    }
   ],
   "source": [
    "[i.split('-')[1] for i in dq_name]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "7e26e3ee",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'series_dq' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [14]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mseries_dq\u001b[49m[dq_name]\u001b[38;5;241m.\u001b[39mvalues\u001b[38;5;241m.\u001b[39mtolist()\n",
      "\u001b[1;31mNameError\u001b[0m: name 'series_dq' is not defined"
     ]
    }
   ],
   "source": [
    "series_dq[dq_name].values.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "8ffc297f",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'dq_name' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [15]\u001b[0m, in \u001b[0;36m<cell line: 6>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpyecharts\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcharts\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Map\n\u001b[0;32m      3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpyecharts\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mfaker\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Faker\n\u001b[0;32m      5\u001b[0m c \u001b[38;5;241m=\u001b[39m (\n\u001b[0;32m      6\u001b[0m     Map()\n\u001b[1;32m----> 7\u001b[0m     \u001b[38;5;241m.\u001b[39madd(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m产品经理地区分布\u001b[39m\u001b[38;5;124m\"\u001b[39m, [\u001b[38;5;28mlist\u001b[39m(z) \u001b[38;5;28;01mfor\u001b[39;00m z \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mzip\u001b[39m([i\u001b[38;5;241m.\u001b[39msplit(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m-\u001b[39m\u001b[38;5;124m'\u001b[39m)[\u001b[38;5;241m1\u001b[39m] \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[43mdq_name\u001b[49m],series_dq[dq_name]\u001b[38;5;241m.\u001b[39mvalues\u001b[38;5;241m.\u001b[39mtolist())], \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m深圳\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m      8\u001b[0m     \u001b[38;5;241m.\u001b[39mset_global_opts(\n\u001b[0;32m      9\u001b[0m         title_opts\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mTitleOpts(title\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mMap-深圳-产品经理\u001b[39m\u001b[38;5;124m\"\u001b[39m), visualmap_opts\u001b[38;5;241m=\u001b[39mopts\u001b[38;5;241m.\u001b[39mVisualMapOpts()\n\u001b[0;32m     10\u001b[0m     )\n\u001b[0;32m     11\u001b[0m     \n\u001b[0;32m     12\u001b[0m )\n\u001b[0;32m     13\u001b[0m c\u001b[38;5;241m.\u001b[39mrender_notebook()\n",
      "\u001b[1;31mNameError\u001b[0m: name 'dq_name' is not defined"
     ]
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Map\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "c = (\n",
    "    Map()\n",
    "    .add(\"产品经理地区分布\", [list(z) for z in zip([i.split('-')[1] for i in dq_name],series_dq[dq_name].values.tolist())], \"深圳\")\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"Map-深圳-产品经理\"), visualmap_opts=opts.VisualMapOpts()\n",
    "    )\n",
    "    \n",
    ")\n",
    "c.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7f5f05c0",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
